<script setup> 
import { ref,onMounted } from 'vue'
import { getGoods } from '@/api/goods'

const defaultProps = {
  children: 'children',
  label: 'name',
}
const getGoodslist = async () => {
  const res = await getGoods()
  data.value = res
}
const data = ref([])
onMounted(()=>{
  getGoodslist()
})

const handleNodeClick = (data) => {
  console.log(data)
}
</script>
<template>
   <el-tree
    style="max-width: 600px"
    :data="data"
    :props="defaultProps"
    @node-click="handleNodeClick"
  />
  <router-view></router-view>
</template>
<style scoped>
</style>